SWiSH Player Support SWF5 or later - Supported Internally
Syntax
myString.split({sep},{limit})
Arguments
sep: The point at which the string is split. This can be either a single character, a string itself, or a variable that represents a string.
limit: An optional argument which determines the number of characters or substrings to place into the array.
Returns
The characters or substrings of the string placed in an array.
Description Method: Splits any String into individual characters or substrings based on the location of the sep argument and the optional limit argument. If no arguments are specified, each individual character of the String is placed into the array separately.
Sample
This example uses no arguments:
onLoad () {
myString = "SWiSHmax";
myString = myString.split();
trace(myString); // displays "S,W,i,S,H,m,a,x" in the debug window
}
This example uses only the 'sep' argument:
onLoad () {
myString = "Dog and Cat";
myString = myString.split(" and ");
trace(myString); // displays "Dog,Cat" in the debug window
}
This example uses both the 'sep' and 'limit' arguments:
onLoad () {
myString = "Dog and Cat and Fish and Bird";
myString = myString.split(" and ", 3);
trace(myString); // displays "Dog,Cat,Fish" in the debug window
}